package com.tjsinfo.tjsoa.bylaws.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.bylaws.bo.IBylawsBO;
import com.tjsinfo.tjsoa.bylaws.dao.IBylawsDao;
import com.tjsinfo.tjsoa.system.vo.User;
import com.tjsinfo.tjsoa.workplan.bo.IWorkPlanMainBo;
// 转入到通知列表
public class BylawsList1Action extends Action {
	
	private IBylawsDao bylawsDao;
	
	public void setBylawsDao(IBylawsDao bylawsDao) {
		this.bylawsDao = bylawsDao;
	}
	

	private IWorkPlanMainBo workPlanMainBo;
	public IWorkPlanMainBo getWorkPlanMainBo() {
		return workPlanMainBo;
	}

	public void setWorkPlanMainBo(IWorkPlanMainBo workPlanMainBo) {
		this.workPlanMainBo = workPlanMainBo;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		try{	
   
			HttpSession session=request.getSession();
			User user = (User)session.getAttribute("user");
			
			List result = null;
			String _articleCid=(String)request.getParameter("cid");
		
			// 根据cid和所拥有的不同权限,为fb赋不同的值
			if((_articleCid.equals("2"))&&(user.getPermission().contains(",17,"))){
				
				request.setAttribute("fb", "tzfb");
			}else{
				
				request.setAttribute("fb", "0");
			}
			if((_articleCid.equals("3"))&&(user.getPermission().contains(",19,"))){
				
				request.setAttribute("fb1", "gzzdfb");
			}else{
				
				request.setAttribute("fb1", "0");
			}
			
			result=bylawsDao.findByTwoProperty("cid", _articleCid,"auditing_sign","1");

		
			request.setAttribute("result", result);
	
			workPlanMainBo.selectMapWorkPlanMain(request);
			return mapping.findForward("success");
		
	}catch(Exception e){			
		e.printStackTrace();
		
		return mapping.findForward("failed");
	}
}
}